<template>
  <div class="no-result">
    <div class="no-result-content">
      <div class="icon"></div>
      <p class="text">{{title}}</p>
    </div>
  </div>
</template>

<script setup>
  import { ref, defineExpose } from 'vue'

  const title = ref('抱歉，没有结果')
  const setTitle = (t) => {
    title.value = t
  }

  defineExpose({
    setTitle
  })

  /* vue2写法也兼容 */
  // export default {
  //   name: 'no-result',
  //   data() {
  //     return {
  //       title: '抱歉，没有结果'
  //     }
  //   },
  //   methods: {
  //     setTitle(title) {
  //       this.title = title
  //     }
  //   }
  // }
</script>

<style lang="scss" scoped>
  .no-result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    .no-result-content {
      text-align: center;
      .icon {
        width: 86px;
        height: 90px;
        margin: 0 auto;
        @include bg-image('./../../../assets/images/default-grey');
        background-size: 86px 90px;
      }
      .text {
        margin-top: 30px;
        font-size: $font-size-medium;
        color: $color-text-d;
      }
    }
  }
</style>
